package top.houry.queue;

import java.util.concurrent.PriorityBlockingQueue;
import java.util.stream.IntStream;

public class PriorityBlockingQueueTest {
    public static void main(String[] args) throws InterruptedException {
        PriorityBlockingQueue<Integer> number = new PriorityBlockingQueue<>();


        number.add(2);
        number.add(3);
        number.add(5);
        number.add(4);
        number.add(6);
        number.add(8);
        number.add(7);
        number.add(1);


        System.out.println();

        System.out.println(number.take());
        System.out.println(number.take());
        System.out.println(number.take());
//        IntStream.range(0, 10).forEach(value -> new Thread(() ->{
//            System.out.println(Thread.currentThread().getName() + "  " + number.poll());
//        }).start());

    }
}
